﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/ResponsiveTheme.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TaggerApp.Admin.Pages.TagManager.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script src="../../Scripts/print.js"></script>
    <link href="../../Style/print.css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <br /><br /><br />
        <div class="row-fluid form-inline">
            <div class="span4">
            <span>Device Type: </span><asp:DropDownList ID="ddListDeviceType" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="SqlDSDDListDeviceType" DataTextField="productTypeDesc" DataValueField="productTypeID">
                 <asp:listitem text="All" value="0" Selected="True">
                </asp:listitem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDSDDListDeviceType" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [tblProductType]"></asp:SqlDataSource>
            </div>
            <div class="span4">
                <span>Status: </span><asp:DropDownList ID="ddListStatus" runat="server" AppendDataBoundItems="true" AutoPostBack="True" DataSourceID="SqlDSDDListStatus" DataTextField="statusDesc" DataValueField="statusID">
                 <asp:listitem text="All" value="0" Selected="True">
                </asp:listitem>
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDSDDListStatus" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [tblStatus]"></asp:SqlDataSource>
            </div>
        </div><br />
    <asp:GridView ID="gvProducts" runat="server" AutoGenerateColumns="False" DataKeyNames="productID" DataSourceID="SqlDSProducts" CssClass="table table-bordered table-hover" AllowPaging="True" AllowSorting="True" PageSize="10">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <input type="checkbox" value="<%#Eval("productName") + "," + Eval("productGUID")%>"/>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="productID" HeaderText="productID" InsertVisible="False" ReadOnly="True" SortExpression="productID" Visible="false" />
            <asp:TemplateField HeaderText="Name" SortExpression="productName">
                <ItemTemplate>
                    <a href="../Devices/Default.aspx?id=<%# Eval("productGUID")%>"><%# Eval("productName") %></a>
                    <asp:Label ID="productName" runat="server" Text='<%# Bind("productName") %>' Visible="false"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="locationName" HeaderText="Location" SortExpression="locationName" />
            <asp:BoundField DataField="productTypeDesc" HeaderText="Product Type" SortExpression="productTypeDesc" />
            <asp:BoundField DataField="statusDesc" HeaderText="Status" SortExpression="statusDesc" />
            <asp:HyperLinkField DataNavigateUrlFormatString="../EditTagInfo/Default.aspx?id={0}" DataNavigateUrlFields="productID" Text="Edit" ControlStyle-CssClass="btn btn-primary" >
<ControlStyle CssClass="btn btn-primary"></ControlStyle>
            </asp:HyperLinkField>
            <asp:BoundField DataField="statusID" HeaderText="statusID" SortExpression="statusID" Visible="False"/>
            <asp:BoundField DataField="productTypeID" HeaderText="productTypeID" SortExpression="productTypeID" Visible="False"/>
            <asp:BoundField DataField="locationID" HeaderText="locationID" SortExpression="locationID" Visible="False"/>
            <asp:BoundField DataField="productGUID" HeaderText="productGUID" SortExpression="productGUID" Visible="False"/>
            <asp:BoundField DataField="productDescription" HeaderText="productDescription" SortExpression="productDescription" Visible="False"/>
            <asp:BoundField DataField="productMfgLink" HeaderText="productMfgLink" SortExpression="productMfgLink" Visible="False"/>
            <asp:BoundField DataField="productCPU" HeaderText="productCPU" SortExpression="productCPU" Visible="False" />
            <asp:BoundField DataField="productOS" HeaderText="productOS" SortExpression="productOS" Visible="False"/>
            <asp:BoundField DataField="productMemory" HeaderText="productMemory" SortExpression="productMemory" Visible="False" />
            <asp:BoundField DataField="productHD" HeaderText="productHD" SortExpression="productHD" Visible="False"/>
            <asp:BoundField DataField="productMedDrive" HeaderText="productMedDrive" SortExpression="productMedDrive" Visible="False"/>
            <asp:BoundField DataField="productPorts" HeaderText="productPorts" SortExpression="productPorts" Visible="False"/>
            <asp:BoundField DataField="productNetwork" HeaderText="productNetwork" SortExpression="productNetwork" Visible="False"/>
            <asp:BoundField DataField="productImgURL" HeaderText="productImgURL" SortExpression="productImgURL" Visible="False"/>
            <asp:BoundField DataField="productDisplayInfo" HeaderText="productDisplayInfo" SortExpression="productDisplayInfo" Visible="False"/>
            <asp:BoundField DataField="productBatteryInfo" HeaderText="productBatteryInfo" SortExpression="productBatteryInfo" Visible="False"/>
            <asp:BoundField DataField="productCameraInfo" HeaderText="productCameraInfo" SortExpression="productCameraInfo" Visible="False"/>
        </Columns>
    </asp:GridView>
    <input type="button" onclick="render()" value="Render Tags" />
    <input id="printButton" type="button" onclick="printdiv('printlabels')" value="Print Tags" style="display:none"/>
        <div id="printTemp" style="display:none;width:612pt;border: 1px solid black; height:792pt">
        <div id="printlabels" class="printlabels">
        <table>
            <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
               <tr>
               <td><div class="printlabel"></div></td><td><div class="printlabel"></div></td><td><div class="printlabel"></div></td>
            </tr>
        </table>
    </div>
</div>
    
    <asp:SqlDataSource ID="SqlDSProducts" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [tblProducts] WHERE [productID] = @productID" InsertCommand="INSERT INTO [tblProducts] ([productName], [productTypeID], [locationID], [productGUID], [productDescription], [productMfgLink], [productCPU], [productOS], [productMemory], [productHD], [productMedDrive], [productPorts], [productNetwork], [productImgURL], [productDisplayInfo], [productBatteryInfo], [productCameraInfo]) VALUES (@productName, @productTypeID, @locationID, @productGUID, @productDescription, @productMfgLink, @productCPU, @productOS, @productMemory, @productHD, @productMedDrive, @productPorts, @productNetwork, @productImgURL, @productDisplayInfo, @productBatteryInfo, @productCameraInfo)" SelectCommand="SELECT tblProducts.productID, tblProducts.productName, tblProducts.productTypeID, tblProducts.locationID, tblProducts.productGUID, tblProducts.productDescription, tblProducts.productMfgLink, tblProducts.productCPU, tblProducts.productOS, tblProducts.productMemory, tblProducts.productHD, tblProducts.productMedDrive, tblProducts.productPorts, tblProducts.productNetwork, tblProducts.productImgURL, tblProducts.productDisplayInfo, tblProducts.productBatteryInfo, tblProducts.productCameraInfo, tblLocation.locationName, tblProductType.productTypeDesc, tblStatus.statusDesc, tblProducts.statusID FROM tblProducts INNER JOIN tblLocation ON tblProducts.locationID = tblLocation.locationID INNER JOIN tblProductType ON tblProducts.productTypeID = tblProductType.productTypeID INNER JOIN tblStatus ON tblProducts.statusID = tblStatus.statusID WHERE (tblProducts.productTypeID = @productTypeID) OR (0 = @productTypeID) AND (tblProducts.statusID = @statusID) OR (0 = @statusID)" UpdateCommand="UPDATE [tblProducts] SET [productName] = @productName, [productTypeID] = @productTypeID, [locationID] = @locationID, [productGUID] = @productGUID, [productDescription] = @productDescription, [productMfgLink] = @productMfgLink, [productCPU] = @productCPU, [productOS] = @productOS, [productMemory] = @productMemory, [productHD] = @productHD, [productMedDrive] = @productMedDrive, [productPorts] = @productPorts, [productNetwork] = @productNetwork, [productImgURL] = @productImgURL, [productDisplayInfo] = @productDisplayInfo, [productBatteryInfo] = @productBatteryInfo, [productCameraInfo] = @productCameraInfo WHERE [productID] = @productID">
        <DeleteParameters>
            <asp:Parameter Name="productID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="productName" Type="String" />
            <asp:Parameter Name="productTypeID" Type="Int32" />
            <asp:Parameter Name="locationID" Type="Int32" />
            <asp:Parameter Name="productGUID" Type="String" />
            <asp:Parameter Name="productDescription" Type="String" />
            <asp:Parameter Name="productMfgLink" Type="String" />
            <asp:Parameter Name="productCPU" Type="String" />
            <asp:Parameter Name="productOS" Type="String" />
            <asp:Parameter Name="productMemory" Type="String" />
            <asp:Parameter Name="productHD" Type="String" />
            <asp:Parameter Name="productMedDrive" Type="String" />
            <asp:Parameter Name="productPorts" Type="String" />
            <asp:Parameter Name="productNetwork" Type="String" />
            <asp:Parameter Name="productImgURL" Type="String" />
            <asp:Parameter Name="productDisplayInfo" Type="String" />
            <asp:Parameter Name="productBatteryInfo" Type="String" />
            <asp:Parameter Name="productCameraInfo" Type="String" />
            <asp:Parameter Name="statusID" Type="Int32" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="ddListDeviceType" Name="productTypeID" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="ddListStatus" Name="statusID" PropertyName="SelectedValue" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="productName" Type="String" />
            <asp:Parameter Name="productTypeID" Type="Int32" />
            <asp:Parameter Name="locationID" Type="Int32" />
            <asp:Parameter Name="productGUID" Type="String" />
            <asp:Parameter Name="productDescription" Type="String" />
            <asp:Parameter Name="productMfgLink" Type="String" />
            <asp:Parameter Name="productCPU" Type="String" />
            <asp:Parameter Name="productOS" Type="String" />
            <asp:Parameter Name="productMemory" Type="String" />
            <asp:Parameter Name="productHD" Type="String" />
            <asp:Parameter Name="productMedDrive" Type="String" />
            <asp:Parameter Name="productPorts" Type="String" />
            <asp:Parameter Name="productNetwork" Type="String" />
            <asp:Parameter Name="productImgURL" Type="String" />
            <asp:Parameter Name="productDisplayInfo" Type="String" />
            <asp:Parameter Name="productBatteryInfo" Type="String" />
            <asp:Parameter Name="productCameraInfo" Type="String" />
            <asp:Parameter Name="statusID" Type="Int32" />
            <asp:Parameter Name="productID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>